package com.tsm.picachu.common;

import com.tsm.picachu.R;

import android.app.Activity;
import android.app.Dialog;
import android.graphics.Color;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.LinearLayout;

public class DialogMenuLose extends Dialog
{
	private Button mButtonRestart = null;
	private Button mButtonChooseLevel = null;
	
	public DialogMenuLose(final Activity activity)
	{
		super(activity);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		getWindow().getDecorView().setBackgroundColor(Color.TRANSPARENT);

		LinearLayout contentLinearLayout = new LinearLayout(activity);
		contentLinearLayout.setBackgroundColor(Color.TRANSPARENT);
		contentLinearLayout.setGravity(Gravity.CENTER);
		contentLinearLayout.setOrientation(LinearLayout.VERTICAL);

		mButtonRestart = new Button(activity);
		mButtonChooseLevel = new Button(activity);

		mButtonRestart.setOnTouchListener(new View.OnTouchListener()
		{
			public boolean onTouch(View v, MotionEvent event)
			{
				mButtonRestart.setBackgroundResource(R.drawable.text_restart_hl);
				mButtonChooseLevel.setBackgroundResource(R.drawable.text_choose_level);
				return false;
			}
		});

		mButtonRestart.setBackgroundResource(R.drawable.text_restart_hl);
		contentLinearLayout.addView(mButtonRestart);

		mButtonChooseLevel.setOnTouchListener(new View.OnTouchListener()
		{
			public boolean onTouch(View v, MotionEvent event)
			{
				mButtonRestart.setBackgroundResource(R.drawable.text_restart);
				mButtonChooseLevel.setBackgroundResource(R.drawable.text_choose_level_hl);
				return false;
			}
		});
		mButtonChooseLevel.setBackgroundResource(R.drawable.text_choose_level);
		contentLinearLayout.addView(mButtonChooseLevel);

		setContentView(contentLinearLayout);
	}
	
	public void setClickListeners(View.OnClickListener restartClickListener, View.OnClickListener chooseLevelClickListener)
	{
		mButtonChooseLevel.setOnClickListener(chooseLevelClickListener);
		mButtonRestart.setOnClickListener(restartClickListener);
	}
	
}
